import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/home/Index.vue'

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'Index',
    component: Index
  },
  {
    path: '/about',//关于我们
    component: () => import('../views/about/Index.vue'),
    children: [{
      path: ':code',
      component: () => import('../views/about/components/About.vue'),
    }, {path: '', redirect: '/about/qygk'}]
  },
  {
    path: '/news',//新闻公告
    component: () => import('../views/news/Index.vue')
  },
  {
    path: '/news/details/:id',//新闻详情
    component: () => import('../views/news/Details.vue')
  },
  {
    path: '/service',//公交服务
    component: () => import('../views/service/Index.vue')
  },
  {
    path: '/search',//公交查询
    component: () => import('../views/search/Index.vue')
  },
  {
    path: '/tour',//公交旅游
    component: () => import('../views/tour/Index.vue')
  }
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,//配置文件中的publicPath
  routes
});

export default router
